Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implemented cksum #39

Closed
wants to merge 1 commit into from
Closed

implemented cksum #39

wants to merge 1 commit into from

Conversation

cospplredman
Copy link
Contributor

quick little implementation of cksum ��

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the binary and then ensure the binary is not pushed by adding it to the .gitignore list

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#define VERSION "0.0.1"
#define AUTHOR "cospplredman"

#include"../version_info.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include"../version_info.h"
#include "/version_info.h"

Comment on lines +10 to +26
#define X(a,...) for(a)for(r=(r<<8)^(e&0xff)^__VA_ARGS__,e=0,i=31;i>23;i--)if(r&(1<<i))r^=(1<<i)|(q>>(32-i)),e^=q<<(i-24);

uint32_t q=0x04c11db7,r,e;d,i=1,t,j,k,f=2;main(c,v)char**v;{
if(c<2)exit(1);
for(;++k<c;){
if(f&&(!strcmp(v[k], "--")|!strcmp(v[k], "-v"))){
if(v[k][1]=='-')f=0;
if(f==2){f=1;print_version();}
continue;
}
FILE*f=fopen(v[k],"r");
if(f==NULL)exit(1);
X(;(d=getc(f))>=0;t++,d)X(j=t;j;,(j&0xff),j>>=8)X(j=3;j--;,0)
if(printf("%u %d %s\n",~((r<<8)|(e&0xff)),t,v[k])<0)exit(1);
r=e=t=0;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you refactor your code to make it readable? The goal isn't to code golf the coreutils

@proh14
Copy link
Owner

proh14 commented Apr 21, 2024

red-birb-wuewue-ezgif com-speed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants